﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Teacher.aspx.cs" Inherits="School_Teacher" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>教工档案</title>
    <link href="../Common/css/main.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #load{width:500px;height:25px;border:1px #000 solid;}
        #loading{position:absolute;z-index:2;height:23;filter:progid:DXImageTransform.microsoft.gradient(gradienttype=1,startColorStr=white,endColorStr=#39867b);}
        #loadtext{position:absolute;z-index:3;width:100%;height:100%;line-height:23px;text-align:center;}
    </style>

    <script type="text/javascript" src="../Common/Js/jquery.js"></script>

    <script type="text/javascript" src="../Common/Js/common.js"></script>

    <script type="text/javascript" src="../Common/Js/msg.js"></script>

    <script type="text/javascript" src="../Common/Js/jsUtil.js"></script>

    <script type="text/javascript">

//全局变量////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//弹出层操作类型
var optionType = ''; 

//当前正在编辑的教工ID                               
var editTeacher = 0;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//过程////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//页面加载
function Load()
{
    Bind(0,"");
    
    //初始化权限表
    InitTeacherPrem();
}

//基本数据绑定
function Bind(queryType,queryValue)
{
    if (queryType == 0)
    {
        document.getElementById('queryType').value = "0";
        document.getElementById('selectPremQuery').style.display = "none"; 
        document.getElementById('queryKeyWord').disabled = true;
        document.getElementById('queryKeyWord').style.display = "inline";   
    }
    
    //查询条件
    document.getElementById('HFQueryType').value = queryType;
    document.getElementById('HFQueryValue').value = queryValue;
    document.getElementById('btnBind').click();
}

//显示添加弹出层
function ShowAddWindow()
{
    optionType = 'add';

    ShowPopForm("popTable", "formTitle", "新增", "");
    showMask();
}

//显示修改弹出层
function ShowUpdateWindow(obj)
{
    optionType = 'update';

    ShowPopForm("popTable", "formTitle", "修改", "");
    showMask();
    
    editTeacher = obj.id;

    //根据教工ID获取教工信息
    PageMethods.SelectTeacherInfo(editTeacher,function(succ){
        if(succ != null)
        {
            //弹出层各项赋值
            document.getElementById('teachercode').value = succ.TeachCode;
            document.getElementById('teachercode').setAttribute("oldCode",succ.TeachCode);
            document.getElementById('teachername').value = succ.TeachName;
            document.getElementById('teachersex').selectedIndex = succ.Sexy;
            
            //数据库最大时间转换（oracle数据库9999-1-1转换为空）
            if (succ.Birthday.getFullYear() != "9999")
            {
                document.getElementById('birth_year').value = succ.Birthday.getFullYear();
                document.getElementById('birth_month').value = succ.Birthday.getMonth() + 1;
                document.getElementById('birth_day').value = succ.Birthday.getDate();
            }
            else
            {
                document.getElementById('birth_year').value = "";
                document.getElementById('birth_month').value = "";
                document.getElementById('birth_day').value = "";
            } 
            
            if (succ.InSchoolDate.getFullYear() != "9999") 
            {
                document.getElementById('workdate_year').value = succ.InSchoolDate.getFullYear();
                document.getElementById('workdate_month').value = succ.InSchoolDate.getMonth() + 1;
                document.getElementById('workdate_day').value = succ.InSchoolDate.getDate();
            }
            else
            {
                document.getElementById('workdate_year').value = "";
                document.getElementById('workdate_month').value = "";
                document.getElementById('workdate_day').value = "";
            }           
        
            //读取教师权限信息，显示在界面中（表现为多选框勾选）
            SetTeacherPremInfo();    
        }

    },function(err){//异步失败
        showMassgeBox("提示","获取教工信息失败，请刷新重试",1,null);
    });
}

//显示批量授权界面
function ShowSetBatchPrem()
{
    var arr = ValidateChecked();
    if(arr.length > 0)
    {
        optionType = 'batch';    
        
        //不显示弹出界面中教工基本信息设置
        ShowBaseInfo(false);
        
        ShowPopForm("popTable", "formTitle", "批量授权", "");
        showMask();
    }
    else
        showMassgeBox("提示","请选择您要设置权限的教职员工");
}

//批量删除教师信息
function DeleteList()
{
    var arr = ValidateChecked();
    if(arr.length > 0)
    {
        //进行批量删除
        showConfirmBox("删除", "此操作会彻底删除选中教工信息，确定删除?", delTeacherInfo, arr);
    }
    else
        showMassgeBox("提示","请选择您要删除的教职员工");
}

//删除教工信息
function delTeacherInfo(obj)
{
    PageMethods.DeleteTeacherInfo(obj,function(succ){
        Bind(0,"");    
        showMassgeBox("提示","教工信息删除成功",1,null);  
            
    },function(err){
        showMassgeBox("提示","教工信息删除失败",1,null);
    });
}

//重置教工密码
function ResetPassword()
{
    var arr = ValidateChecked();
    if(arr.length > 0)
        showConfirmBox("重置密码", "确认将选中教工密码恢复为初始密码?", resetPassword, arr);
    else
        showMassgeBox("提示","请选择您要重置密码的教工",1,null);
}
function resetPassword(arr)
{
    PageMethods.ResetPassword(arr,function(succ){
        Bind(0,"");    
        showMassgeBox("提示","重置密码成功",1,null);
    },function(err){
       showMassgeBox("提示","重置密码失败",1,null);
    });
}

//批量设置教工权限
function Batch(premlist)
{ 
    var arr = ValidateChecked();
    if(arr.length > 0)
    {
        PageMethods.BatchSetPrem(arr,premlist,function(succ){
            if(succ > 0)
            {
                Bind(0,"");
                CloseMask('popTable');
            }
            else
            {
                showMassgeBox("提示","教工权限设置失败",1,null);
            }
        },function(err){
            showMassgeBox("提示","教工权限设置失败，您可以刷新后重试",1,null);
        }); 
    }
}


//操作部分------------------------------------------------------------------------------------------------------------------------------------------------

//保存按钮被按下
function Save()
{ 
    //获取教工权限表
    var premlist = GetCheckPremList();
    
    if(optionType == "batch")
    {
       Batch(premlist);
       return;
    }

    var teacherCode = document.getElementById('teachercode').value.Trim();
    var teacherName = document.getElementById('teachername').value.Trim();
    var teacherSexy = document.getElementById('teachersex').options[document.getElementById('teachersex').selectedIndex].value;
    var teacherBirthday = "";
    var teacherInSchoolTime = "";
     
    if ( (document.getElementById('birth_year').value != "")  || 
         (document.getElementById('birth_month').value != "") || 
         (document.getElementById('birth_day').value != "") )
    {
        teacherBirthday = document.getElementById('birth_year').value + 
                     '-'+ document.getElementById('birth_month').value + 
                     '-'+ document.getElementById('birth_day').value;
    }
    if ( (document.getElementById('workdate_year').value != "")  || 
         (document.getElementById('workdate_month').value != "") || 
         (document.getElementById('workdate_day').value != "") )
    {
        teacherInSchoolTime = document.getElementById('workdate_year').value + 
                     '-'+ document.getElementById('workdate_month').value + 
                     '-'+ document.getElementById('workdate_day').value;
    }

        
    //判断工号是否为空
    if (teacherCode == "")
    {
        showNoticMsg('teachercode','工号不能为空，请重新输入');
        document.getElementById('teachercode').select();  
        return;  
    }
    //判断姓名是否为空
    if (teacherName == "")
    {
        showNoticMsg('teachername','姓名不能为空，请重新输入');
        document.getElementById('teachername').select();  
        return;  
    }
    if (getStringCount(teacherCode) > 20)
    {
        showNoticMsg('teachercode','教师工号不能超过二十个字符，请重新输入');
        document.getElementById('teachercode').select();  
        return;  
    }
    if (containSpecialChar(teacherCode))
    {
        showNoticMsg('teachercode','教师工号存在特殊字符，请重新输入');
        document.getElementById('teachercode').select();  
        return;  
    }
    if (containSpecialChar(teacherName))
    {
        showNoticMsg('teachername','教师姓名存在特殊字符，请重新输入');
        document.getElementById('teachername').select();  
        return;  
    }
    if ( (teacherBirthday != "") && (!validDate(teacherBirthday)) )
    {
        showNoticMsg('birth_year',"日期格式不正确，请重新输入");
        document.getElementById('birth_year').select(); 
        return;
    }
    
    if ( (teacherInSchoolTime != "") && (!validDate(teacherInSchoolTime)) )
    {
        showNoticMsg('workdate_year',"日期格式不正确，请重新输入");
        document.getElementById('workdate_year').select(); 
        return;
    }
    
    if(optionType == "add")
    {
       Add(teacherCode,teacherName,teacherSexy,teacherBirthday,teacherInSchoolTime,premlist);
    }
    if(optionType == "update")
    {
       Update(editTeacher,teacherCode,teacherName,teacherSexy,teacherBirthday,teacherInSchoolTime,premlist);
    }
}

//添加
function Add(teacherCode,teacherName,teacherSexy,teacherBirthday,teacherInSchoolTime,premlist)
{
    var teacherInfo = {RID:0,TeachCode:teacherCode,TeachName:teacherName,Sexy:teacherSexy,Birthday:teacherBirthday,InSchoolDate:teacherInSchoolTime};

    PageMethods.ValidateTeacherInfo(teacherInfo,function(succ){ 
       if(succ > 0)
       {
                if (succ == 1)
                {
                    showNoticMsg('teachercode','该工号已存在，请重新输入');
                    document.getElementById('teachercode').select();  
                }
                
                if (succ == 2)
                {
                    showNoticMsg('teachercode','该工号已作废，请重新输入');
                    document.getElementById('teachercode').select();  
                    return;
                }
       }
       else
       {  
            PageMethods.InsertTeacherInfo(teacherInfo,premlist,function(succ){
                if(succ > 0)
                {
                    Bind(0,"");
                    CloseMask('popTable');
                }
                else
                {
                    showMassgeBox("提示","教工信息添加失败",1,null);
                }
            },function(err){
                showMassgeBox("提示","教工信息添加失败，您可以刷新后重试",1,null);
            }); 
       }      
    },function(err){
            showMassgeBox("提示","教工信息验证过程失败，您可以刷新后重试",1,null);
    });
}

//修改
function Update(editTeacher,teacherCode,teacherName,teacherSexy,teacherBirthday,teacherInSchoolTime,premlist)
{
    var teacherInfo = {RID:editTeacher,TeachCode:teacherCode,TeachName:teacherName,Sexy:teacherSexy,Birthday:teacherBirthday,InSchoolDate:teacherInSchoolTime};
    
    var oldCode = document.getElementById('teachercode').getAttribute("oldCode");
    //判断教工工号是否修改，先验证后更新
    if (oldCode != teacherCode)
    {
        PageMethods.ValidateTeacherInfo(teacherInfo,function(succ){ 
           if(succ > 0)
           {
                if (succ == 1)
                {
                    showNoticMsg('teachercode','该工号已存在，请重新输入');
                    document.getElementById('teachercode').select();  
                }
                
                if (succ == 2)
                {
                    showNoticMsg('teachercode','该工号已作废，请重新输入');
                    document.getElementById('teachercode').select();  
                    return;
                }
           }
           else
           {  
                PageMethods.UpdateTeacherInfo(teacherInfo,premlist,function(succ){
                    if(succ > 0)
                    {
                        Bind(0,"");
                        CloseMask('popTable');
                    }
                    else
                    {
                        showMassgeBox("提示","教工信息修改失败",1,null);
                    }
                },function(err){
                    showMassgeBox("提示","教工信息修改失败，您可以刷新后重试",1,null);
                }); 
           }
        },function(err){
             showMassgeBox("提示","教工信息验证过程失败，您可以刷新后重试",1,null);
        });
    }
    //没有修改的情况直接更新
    else
    {
        PageMethods.UpdateTeacherInfo(teacherInfo,premlist, function(succ){
            if(succ > 0)
            {
                Bind(0,"");
                CloseMask('popTable');
            }
            else
            {
                showMassgeBox("提示","教工信息修改失败",1,null);
            }
        },function(err){
            showMassgeBox("提示","教工信息修改失败，您可以刷新后重试",1,null);
        }); 
    }
}

//查询部分------------------------------------------------------------------------------------------------------------------------------------------------

//查询按钮按下
function QueryTeacher()
{
    var qType = document.getElementById('queryType').value;
    var qKeyWord = document.getElementById('queryKeyWord').value.Trim();
    
    if (containSpecialChar(qKeyWord))
    {
        showNoticMsg('queryKeyWord',"查询内容不能包含特殊字符",-150);
        return;
    }

    //权限查询
    if (qType == "3")
    {
        var premNo = document.getElementById('selectPremQuery').value;
        Bind(qType,premNo);
    }
    //其他查询
    else
    {
        Bind(qType,qKeyWord);
    }  
}

//在文本框中按回车快捷触发查询
function submitQuery()
{
    if(event.keyCode==13)     
    {     
        event.keyCode=9;   
        event.returnValue = false;
        document.getElementById('btnquery').click();     
    }   
}

//查询方式变化，控制界面样式调整
function queryType_Change(obj)
{
    if (obj.value == "0")
    {
        document.getElementById('selectPremQuery').style.display = "none"; 
        document.getElementById('queryKeyWord').disabled = true;
        document.getElementById('queryKeyWord').style.display = "inline";   
    }
    if (obj.value == "1")
    {
        document.getElementById('selectPremQuery').style.display = "none"; 
        document.getElementById('queryKeyWord').disabled = false;
        document.getElementById('queryKeyWord').style.display = "inline";   
    }
    if (obj.value == "2")
    {
        document.getElementById('selectPremQuery').style.display = "none"; 
        document.getElementById('queryKeyWord').disabled = false;
        document.getElementById('queryKeyWord').style.display = "inline";   
    }
    if (obj.value == "3")
    {
        document.getElementById('selectPremQuery').style.display = "inline"; 
        document.getElementById('queryKeyWord').disabled = false;
        document.getElementById('queryKeyWord').style.display = "none";   
    }  
        
    document.getElementById('queryKeyWord').value = "";
}

//设置行高亮显示
function SetHightLight(obj)
{
     obj.style.backgroundColor = "#fffccf";
     var table = document.getElementById('teacherTable');
     for(var i =0 ; i < table.rows.length;i++)
     {
        var row = table.rows[i];
        if(row != null && row.id != obj.id)
            row.style.backgroundColor = "#ffffff";
        
     }
}

//其他----------------------------------------------------------------------------------------------------------------------------------------------------

//全选
function CheckedAll(obj)
{
    var checkItems=document.getElementById("teacherTable").getElementsByTagName('input');
    for(var i=0;i < checkItems.length;i++){
　　　　var checkItem= checkItems[i];
　　　　if(checkItem.type==='checkbox'){
　　　　　checkItem.checked = obj.checked ;
　　　　}
　　}
}

//获取所有选择教工的ID列表
function ValidateChecked()
{
    var arr = new Array();
    if(document.getElementById("teacherTable") != null)
    {
        var checkItems=document.getElementById("teacherTable").getElementsByTagName('input');
　　    for(var i=1;i < checkItems.length;i++){
　　　　    var checkItem= checkItems[i];
　　　　    if(checkItem.type==='checkbox' && checkItem.checked)
　　　　    {
　　　　        arr.push(checkItem.userid);
　　　　    }
　　    }
　　}
    return arr;
}

//关闭遮掩层
function CloseMask(formId)
{
    ReleasePopTable();
    ClosePopForm(formId,true);
    hideMask();
}

//添加或更新操作成功后清空内容
function ReleasePopTable()
{
    document.getElementById('teachercode').value = "";
    document.getElementById('teachername').value = "";
    
    document.getElementById('birth_year').value = "";
    document.getElementById('birth_month').value = "";    
    document.getElementById('birth_day').value = "";
    document.getElementById('workdate_year').value = "";    
    document.getElementById('workdate_month').value = "";
    document.getElementById('workdate_day').value = "";
    document.getElementById('teachersex').selectedIndex = 0;
    
    //请空教师权限信息（去掉所有被勾选项）
    SetAllPremCheckbox(false);
    document.getElementById('chkAllSelect').checked = false;
    
    //显示弹出界面中教工基本信息设置
    ShowBaseInfo(true)
}

    
//-----------------------------------------------------------------------------------------------------------------------------------------
//教工权限相关

//初始化权限表
function InitTeacherPrem()
{
    var table = document.getElementById('TABLEPrem');
    //清空表格
    while(table.rows.length)
    {
        table.deleteRow(0); 
    }

    //获取教师权限信息并显示
    PageMethods.GetSystemInfo(function(subsys){
        if (subsys != null)
        {
            //初始化教工权限表
            for(var i = 0; i < subsys.length; i++)
            {
                var newTH = table.insertRow();
                var newTD = newTH.insertCell();
                newTD.setAttribute("id","TDPrem" + subsys[i].SystemNo);
                
                var SSPTableId = "SSPTable" + subsys[i].SystemNo;
                newTD.innerHTML = subsys[i].SystemName + "<br /><div><table id=" + SSPTableId + " style=\"width: 95%; text-align:left;margin-left: 20px;\"></table></div>";          
                
//                InitSubPrem(SSPTableId,subsys[i].SystemNo,i);
            }
        }

    },function(err){//异步失败
        showMassgeBox("提示","获取子系统信息失败，请刷新重试",1,null);
    });
}

//初始化子系统权限表
function InitSubPrem(tableId,subsysNo,rowIndex)
{
    //子系统权限表
    var tablesys = document.getElementById(tableId);
    var newsysTH = tablesys.insertRow();
             
    //根据子系统编号获取权限信息
    PageMethods.GetPremInfoBySysNo(subsysNo,function(succ){
        if(succ != null)
        {
            //排除不存在的权限子系统
            if (succ.length == 0)
            {
                var table = document.getElementById('TABLEPrem');
                table.deleteRow(rowIndex);
                return;
            }

            //添加权限
            for(var i = 0; i < succ.length; i++)
            {
                var newsysTD = newsysTH.insertCell();
                newsysTD.setAttribute("width","25%");
                var SSPChkId = "SSPChkId" + succ[i].PremNo;
                var premName = "";
                var title = "";

                if (succ[i].PremName.length > 8)
                {
                    premName = succ[i].PremName.substring(0,7) + "...";
                    title = succ[i].PremName;
                }
                else
                    premName = succ[i].PremName;
                    
                newsysTD.innerHTML = "<input type=\"checkbox\" premno=" + succ[i].PremNo + " id=" + SSPChkId + " /><font title=\"" + title + "\">&nbsp;" + premName + "</font>";
            }
            
            //多余的补空格
            var emptyNum = 4 - succ.length;
            for(var j = 0; j < emptyNum; j++)
            {
                var newsysTD = newsysTH.insertCell();
                newsysTD.setAttribute("width","25%");
                newsysTD.innerHTML = "&nbsp;";
            }
        }

    },function(err){//异步失败
        showMassgeBox("提示","获取权限信息失败，请刷新重试",1,null);
    });
}

//读取教师权限信息，显示在界面中（表现为多选框勾选）
function SetTeacherPremInfo()
{
    SetAllPremCheckbox(true)
//    //获取教师的所有权限列表
//    PageMethods.GetTeacherPremList(editTeacher,function(succ){
//        if(succ != null)
//        {
//            for(var i = 0; i < succ.length; i++)
//            {
//                var checkbox = document.getElementById('SSPChkId' + succ[i].PNo);
//                checkbox.checked = true;
//            }
//        }
//    },function(err){//异步失败
//        showMassgeBox("提示","获取教师权限信息失败，请刷新重试",1,null);
//    });
}

//全选或全不选权限复选框
function SetAllPremCheckbox(isChecked)
{
    var checkItems=document.getElementById("TABLEPrem").getElementsByTagName('input');
    for(var i=0;i < checkItems.length;i++){
　　    var checkItem= checkItems[i];
　　    if(checkItem.type==='checkbox'){
　　　      checkItem.checked = isChecked;
　　    }
    }
}

//获取教师权限表
function GetCheckPremList()
{  
    var arr = new Array();
    if(document.getElementById("TABLEPrem") != null)
    {
        var checkItems=document.getElementById("TABLEPrem").getElementsByTagName('input');
        for(var i=0;i < checkItems.length;i++){
　　        var checkItem= checkItems[i];
　　        if(checkItem.type==='checkbox' && checkItem.checked)
　　        {
　　            arr.push(checkItem.premno);
　　        }
        }
    }
    return arr;
}

//根据子系统编号，向查询下拉列表中添加权限
function SetPremIntoSelect(selectId, sysNo)
{
    var selectPrem = document.getElementById(selectId);

    //根据子系统编号获取权限信息
    PageMethods.GetPremInfoBySysNo(sysNo,function(succ){
        if(succ != null)
        {
            for(var j = 0; j < succ.length; j++)
            {
                //添加子系统名
                var oOption = document.createElement("OPTION");
                oOption.text=succ[j].PremName;
                oOption.value=succ[j].PremNo;
                selectPrem.add(oOption);
            }
        }

    },function(err){//异步失败
        showMassgeBox("提示","获取权限信息失败，请刷新重试",1,null);
    });
}

//显示或不显示弹出界面中教工基本信息设置
function ShowBaseInfo(isShow)
{
    var tableInfo = document.getElementById('PTableInfo');
    var InfoRow1 = tableInfo.rows.item(0);
    var InfoRow2 = tableInfo.rows.item(1);
    
    if (isShow == true)
    {
        InfoRow1.style.display = "inline";
        InfoRow2.cells.item(0).style.display = "inline";
        InfoRow2.cells.item(1).style.display = "inline";
        InfoRow2.cells.item(2).style.display = "inline";
        InfoRow2.cells.item(3).style.display = "inline";
       
    }
    else
    {
        InfoRow1.style.display = "none";
        InfoRow2.cells.item(0).style.display = "none";
        InfoRow2.cells.item(1).style.display = "none";
        InfoRow2.cells.item(2).style.display = "none";
        InfoRow2.cells.item(3).style.display = "none";    

        InfoRow2.cells.item(4).style.width = "6%";                  
    }
}


//导入操作------------------------------------------------------------------------------------------------------------------------------------------------

//开始导入
function GetActionString()
{
    var type = 0;
    if (document.getElementById("chkOverWrite").checked)
        type = 1;
        
    document.getElementById("form2").action = "ImportTeacher.aspx?optype=" + type;
}
    
//弹出导入文件对话框
function ImportHandle()
{
    document.getElementById("chkOverWrite").checked = false;
    ShowPopForm("ImportForm", "ImportFormTitle", "Excel导入");
    document.getElementById("upload").innerHTML='<input id="File1"  name="File1" type="file" style="width:300px" />';
}

function CloseForm()
{
   ClosePopForm("ImportForm");
}

function DownLoadExcel()
{
    document.getElementById("downloadFrame").src = "templatedownload.aspx?templatetype=teacher";
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    </script>

</head>
<body onload="Load();">
    <div class="mainWarp">
        <div class="pageBody">
            <form id="form1" runat="server">
                <div>
                    <ul class="butList">
                        <li>
                            <table width="100%" border="0">
                                <tr>
                                    <td width="60%" style="text-align: left;">
                                        <input type="button" id="button3" value="新增" onclick="ShowAddWindow();" class="commonBut" />
                                        <input type="button" id="btnDel" value="删除" class="commonBut" onclick="DeleteList();" />
                                        <input type="button" id="resetPass" value="重置密码" onclick="ResetPassword();" class="commonBut" />
                                        <input type="button" id="Button1" value="批量授权" onclick="ShowSetBatchPrem();" class="commonBut" style="display:none" />
                                        <input type="button" id="button7" value="导入" class="commonBut" onclick="ImportHandle();" />
                                        <a href="javascript:DownLoadExcel()" title="下载导入模板">下载导入模板</a>
                                    </td>
                                    <td width="50%" style="text-align: right;">
                                        查询方式:<select id="queryType" style="width: 120px" onchange="queryType_Change(this);">
                                            <option value="0" selected>所有</option>
                                            <option value="1">工号</option>
                                            <option value="2">姓名</option>
                                            <%--<option value="3">权限</option>--%>
                                        </select>
                                        <input type="text" name="textfield" id="queryKeyWord" onkeydown="submitQuery();"
                                            class="txtStyle" style="width: 120px" />
                                        <select id="selectPremQuery" style="width: 120px; display: none;">
                                            <%= Common.GetPremOption(2)%>
                                        </select>
                                        <input id="btnquery" class="commonBut" onclick="QueryTeacher();" type="button" value="查询" />
                                    </td>
                                </tr>
                            </table>
                        </li>
                    </ul>
                </div>
                <div>
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
                    </asp:ScriptManager>
                </div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Repeater ID="Repeater1" runat="server">
                            <HeaderTemplate>
                                <table id="teacherTable" border="0" cellpadding="0" cellspacing="1" class="useList">
                                    <tr class="tableTitle">
                                        <th width="5%" height="26">
                                            <input type="checkbox" onclick="CheckedAll(this);" /></th>
                                        <th width="20%" style="text-align: left; padding-left: 5px;">
                                            工号</th>
                                        <th width="20%" style="text-align: left; padding-left: 5px;">
                                            姓名</th>
                                        <th style="text-align: left; padding-left: 5px;" width="5%">
                                            性别</th>
                                        <th style="text-align: left; padding-left: 5px;" width="15%">
                                            出生日期</th>
                                        <th style="text-align: left; padding-left: 5px;" width="15%">
                                            参加工作日期</th>
                                        <th width="10%" style="display:none">
                                            拥有权限</th>
                                        <th width="10%">
                                        </th>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr id="<%# DataBinder.Eval(Container.DataItem, "RID") %>" style="background-color: White;"
                                    onclick="SetHightLight(this);">
                                    <td height="26">
                                        <input type="checkbox" userid="<%# DataBinder.Eval(Container.DataItem, "RID") %>" />
                                    </td>
                                    <td style="text-align: left; font-weight: normal; padding-left: 5px;">
                                        <%# DataBinder.Eval(Container.DataItem, "TeachCode")%>
                                    </td>
                                    <td style="text-align: left; font-weight: normal; padding-left: 5px;">
                                        <%# DataBinder.Eval(Container.DataItem, "TeachName")%>
                                    </td>
                                    <td style="text-align: left; font-weight: normal; padding-left: 5px;">
                                        <%# DataBinder.Eval(Container.DataItem, "SexyStr")%>
                                    </td>
                                    <td style="text-align: left; font-weight: normal; padding-left: 5px;">
                                        <%# DataBinder.Eval(Container.DataItem, "BirthdayStr")%>
                                    </td>
                                    <td style="text-align: left; font-weight: normal; padding-left: 5px;">
                                        <%# DataBinder.Eval(Container.DataItem, "InSchoolDateStr")%>
                                    </td>
                                    <td style="display:none">
                                        <img src="../common/images/prem.gif" alt="拥有权限" style="visibility: <%# HaveAnyPrem(DataBinder.Eval(Container.DataItem, "RID")) %>" />
                                    </td>
                                    <td>
                                        <img src="../common/images/hadle_icon.gif" alt="修改教师信息" class="imageBtnStyle" onclick="ShowUpdateWindow(this.parentElement.parentElement);" />
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" HorizontalAlign="Right" PageSize="15"
                            Width="100%" PagingButtonSpacing="10px" ButtonImageAlign="left" OnPageChanged="AspNetPager1_PageChanged">
                        </webdiyer:AspNetPager>
                        </td> </tr> </table>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnBind" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                <div style="display: none;">
                    <asp:Button ID="btnBind" runat="server" OnClick="btnBind_Click" Text="btnBind" />
                    <asp:HiddenField ID="HFQueryType" runat="server" Value="" />
                    <asp:HiddenField ID="HFQueryValue" runat="server" Value="" />
                    <iframe src="" name="ifram" id="downloadFrame" style="height: 80%; width: 95%; overflow-y: auto;
                        overflow-x: none;" frameborder="0"></iframe>
                </div>
            </form>
            <!-- 新增/修改学校弹出界面 开始-->
            <div id="popTable" class="layoutWarp" style="display: none; width: 600px; overflow: inherit;">
                <div class="title">
                    <span id="formTitle">新增</span> <a title="关闭" onclick="return CloseMask('popTable')">
                        关闭</a>
                </div>
                <table id="PTableInfo" style="width: 95%; margin-top: 12px;" border="0" class="layoutTable">
                    <tr>
                        <td width="10%" valign="top" style="text-align: right;">
                            工号:</td>
                        <td style="text-align: left; width: 25%; color: Red">
                            <input type="text" name="textfield" id="teachercode" class="txtStyle" maxlength="20"
                                style="width: 120px" />
                            *</td>
                        <td width="15%" valign="top" style="text-align: right">
                            姓名:</td>
                        <td style="text-align: left; width: 25%; color: Red">
                            <input id="teachername" name="textfield2" class="txtStyle" type="text" maxlength="10"
                                style="width: 120px" />
                            *</td>
                        <td width="8%" style="text-align: right" valign="top">
                            性别:</td>
                        <td style="text-align: left; width: 10%;">
                            <select id="teachersex" style="width: 44px">
                                <option value="0" selected="selected">男</option>
                                <option value="1">女</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right" valign="top">
                            出生日期:</td>
                        <td style="text-align: left;">
                            <input id="birth_year" class="txtStyle" maxlength="4" name="textfield2" type="text"
                                style="width: 38px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                            -
                            <input id="birth_month" class="txtStyle" maxlength="2" name="textfield2" type="text"
                                style="width: 20px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                            -
                            <input id="birth_day" class="txtStyle" maxlength="2" name="textfield2" type="text"
                                style="width: 20px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                        </td>
                        <!-- 日期格式：2009-9-9 -->
                        <td style="text-align: right" valign="top">
                            参加工作日期:</td>
                        <td style="text-align: left;">
                            <input id="workdate_year" class="txtStyle" maxlength="4" name="textfield2" type="text"
                                style="width: 38px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                            -
                            <input id="workdate_month" class="txtStyle" maxlength="2" name="textfield2" type="text"
                                style="width: 20px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                            -
                            <input id="workdate_day" class="txtStyle" maxlength="2" name="textfield2" type="text"
                                style="width: 20px; text-align: center; border-left: 0px; border-top: 0px; border-right: 0px;"
                                onkeypress="event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));" />
                        </td>
                        <td style="text-align: right;display:none">
                            全选
                        </td>
                        <td style="text-align: left;display:none">
                            <input type="checkbox" id="chkAllSelect" onclick="SetAllPremCheckbox(this.checked)" />
                        </td>
                    </tr>
                    <!-- 权限部分 -->
                    <tr>
                        <td colspan="6" valign="top" style="display:none">
                            <table id="TABLEPrem" style="width: 100%; text-align: left;" border="0">
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" align="center">
                            <ul class="butList">
                                <input type="button" id="btnsave" value="保存" onclick="Save()" class="commonBut" />
                                <input type="button" value="取消" onclick=" CloseMask('popTable');" class="commonBut" />
                            </ul>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- 新增/修改学校弹出界面 结束 -->
        </div>
    </div>
    <!-- 导入开始 -->
    <div id="ImportForm" class="layoutWarp" style="display: none; width: 350px; overflow: inherit;">
        <div class="title">
            <span id="ImportFormTitle"></span><a title="关闭" onclick="CloseForm();">关闭</a>
        </div>
        <table border="0" class="layoutTable" style="width: 340px;">
            <form id="form2" target="t" enctype="multipart/form-data" method="post" onsubmit="GetActionString()">
                <tr id="row3">
                    <td height="60" align="center" colspan="3">
                        <table border="0" style="width: 100%; margin-left: 10px;" >
                            <tr>
                                <td id="upload" align="left">
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <input type="checkbox" id="chkOverWrite"/> 覆盖工号相同的教师信息
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="submit" value="确定" class="commonBut" />&nbsp;&nbsp;
                                    <input id="Submit3" type="button" value="取消" class="commonBut" onclick="CloseForm();" />
                                    <iframe name="t" style="display: none"></iframe>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </form>
        </table>
    </div>
</body>
</html>
